'use strict';
angular.module('com.dcos.app').directive('confirm',['$uibModal',function($uibModal) {
	return {
		restrict: 'A',
		scope: true,
		link: function (scope, element,attrs) {
			scope.delete_id=attrs.id;
			scope.msg=attrs.msg;
			element.bind("click", function() {
				var modalConfirm = $uibModal.open({
					templateUrl: "../../directive/confirm/confirm.html",
					controller:['$scope','$uibModalInstance', function($scope,$uibModalInstance){
						$scope.msg=scope.msg;
	                    $scope.confirm_ok = function () {
	                        scope.ok(scope.delete_id);
	                        $uibModalInstance.close(true);
	                    };

	                    $scope.confirm_cancel = function () {
	                        $uibModalInstance.dismiss('cancel');
	                    };
					}],
					size:'sm'
				});
			});
		}
	}
}]);
